/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app.entities.model.MockDAOImpl;

import app.entities.MOCK.MockPersistencia;
import java.util.ArrayList;
import app.entities.model.DAO.ProfessorDAO;
import app.entities.model.DTO.ProfessorDTO;

/**
 *
 * @author Murilo
 */
public class MockProfessorDAOImpl implements ProfessorDAO {

    @Override
    public void salvar(ProfessorDTO dto) {
        MockPersistencia.getInstanciaListaProfessores().add(dto);
    }

    @Override
    public void deletar(ProfessorDTO dto) {
        MockPersistencia.getInstanciaListaProfessores().remove(dto);
    }

    @Override
    public void atualizar(ProfessorDTO dto) {
        for (ProfessorDTO p : MockPersistencia.getInstanciaListaProfessores()) {
            if (p.getId() == dto.getId()) {
                p.setNome(dto.getNome());
                p.setSobrenome(dto.getSobrenome());
                p.setDataDeNascimento(dto.getDataDeNascimento());
            }
        }  
    }

    @Override
    public ArrayList listar() {
        return MockPersistencia.getInstanciaListaProfessores();
    }
}
